package group;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

public class GroupUseful {
	public GroupUseful() {
		Display display = new Display();
		Shell shell = new Shell(display);
		shell.setSize(600, 400);
		shell.setLayout(new GridLayout(1, true));
		
		final Composite comp=new Composite(shell,SWT.BORDER);
		comp.setLayout(new GridLayout(2,true));
		
		createNVDialogArea(comp);
	
		shell.pack();
		shell.open();

		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
		display.dispose();
	}

	public static void main(String[] args) {
		new GroupUseful();
	}
	
	// 设备名称
	private Text textName;
	// rpu编号
	private Text textrpuNum;
	// 设备类型
	private Text textEquType;
	// 版本号
	private Text textVersion;
	// 序列号
	private Text textSerNo;
	// 信令端口
	private Text textPgPort;
	// 媒体端口
	private Text textStreamPort;
	// 心跳周期
	private Text textHeart;
	// 接入 ip
	private Text textInIp;
	// 接入名称
	private Text textServerName;
	// 接入端口
	private Text textINPort;
	
	private Composite composite;

	protected void createNVDialogArea(Composite container) {
		container.setLayout(new GridLayout());
		composite = new Composite(container, SWT.NONE);
		composite.setLayout(new GridLayout(1, false));
		
		Composite compositeBasic = new Composite(composite, SWT.NONE);
		compositeBasic.setLayout(new GridLayout(1, false));
		compositeBasic.setLayoutData(new GridData(550, 145));
		
		
		final Group group = new Group(compositeBasic, SWT.NONE);
		group.setText("基本信息");
		group.setLayout(new GridLayout(2, false));
		GridData gdDatainfo = new GridData(530, 110);
		group.setLayoutData(gdDatainfo);
		
		Composite leftComposite = new Composite(group, SWT.NONE);
		GridData gdGridleft = new GridData(256, 103);
		gdGridleft.verticalAlignment = SWT.TOP;
		leftComposite.setLayout(new FormLayout());
		leftComposite.setLayoutData(gdGridleft);
		GridData gdGridright = new GridData(264, 103);
		gdGridright.verticalAlignment = SWT.TOP;
		final FormData formlname = new FormData();
		formlname.right = new FormAttachment(0, 72);
		formlname.left = new FormAttachment(0, 17);
		formlname.top = new FormAttachment(0, 8);
		formlname.bottom = new FormAttachment(0, 34);
		Label labname = new Label(leftComposite, SWT.NONE);
		labname.setText("设备名称");
		labname.setLayoutData(formlname);
		final FormData formtname = new FormData();
		formtname.right = new FormAttachment(0, 250);
		formtname.left = new FormAttachment(0, 73);
		formtname.top = new FormAttachment(0, 8);
		formtname.bottom = new FormAttachment(0, 34);
		textName = new Text(leftComposite, SWT.BORDER);
		textName.setLayoutData(formtname);
		final FormData formlnum = new FormData();
		formlnum.right = new FormAttachment(0, 73);
		formlnum.left = new FormAttachment(0, 18);
		formlnum.top = new FormAttachment(0, 40);
		formlnum.bottom = new FormAttachment(0, 70);
		Label lab3 = new Label(leftComposite, SWT.NONE);
		lab3.setText("设备编码");
		lab3.setLayoutData(formlnum);
		final FormData formtnum = new FormData();
		formtnum.right = new FormAttachment(0, 225);
		formtnum.left = new FormAttachment(0, 73);
		formtnum.top = new FormAttachment(0, 38);
		formtnum.bottom = new FormAttachment(0, 66);
		textrpuNum = new Text(leftComposite, SWT.BORDER);
		textrpuNum.setLayoutData(formtnum);

		Button btnButton = new Button(leftComposite, SWT.BORDER);

		final FormData formtbtn = new FormData();
		formtbtn.right = new FormAttachment(0, 250);
		formtbtn.left = new FormAttachment(0, 230);
		formtbtn.top = new FormAttachment(0, 38);
		formtbtn.bottom = new FormAttachment(0, 64);
		btnButton.setLayoutData(formtbtn);
		btnButton.setText("...");

		Composite rightComposite = new Composite(group, SWT.NONE);
		rightComposite.setLayout(new FormLayout());
		rightComposite.setLayoutData(gdGridright);

		final FormData formltype = new FormData();
		formltype.right = new FormAttachment(0, 80);
		formltype.left = new FormAttachment(0, 32);
		formltype.top = new FormAttachment(0, 8);
		formltype.bottom = new FormAttachment(0, 34);
		Label labtype = new Label(rightComposite, SWT.NONE);
		labtype.setText("设备型号");
		labtype.setLayoutData(formltype);
		final FormData formttype = new FormData();
		formttype.right = new FormAttachment(0, 260);
		formttype.left = new FormAttachment(0, 90);
		formttype.top = new FormAttachment(0, 8);
		formttype.bottom = new FormAttachment(0, 34);
		textEquType = new Text(rightComposite, SWT.BORDER | SWT.READ_ONLY);
		textEquType.setBackground(ColorManager.lightGray);
		textEquType.setLayoutData(formttype);
		final FormData formlmajor = new FormData();
		formlmajor.right = new FormAttachment(0, 82);
		formlmajor.left = new FormAttachment(0, 45);
		formlmajor.top = new FormAttachment(0, 39);
		formlmajor.bottom = new FormAttachment(0, 60);
		Label labmajor = new Label(rightComposite, SWT.NONE);
		labmajor.setText("版本号");
		labmajor.setLayoutData(formlmajor);
		final FormData formtmajor = new FormData();
		formtmajor.right = new FormAttachment(0, 260);
		formtmajor.left = new FormAttachment(0, 90);
		formtmajor.top = new FormAttachment(0, 39);
		formtmajor.bottom = new FormAttachment(0, 65);
		textVersion = new Text(rightComposite, SWT.BORDER | SWT.READ_ONLY);
		textVersion.setBackground(ColorManager.lightGray);
		textVersion.setLayoutData(formtmajor);
		final FormData formlno = new FormData();
		formlno.right = new FormAttachment(0, 82);
		formlno.left = new FormAttachment(0, 45);
		formlno.top = new FormAttachment(0, 70);
		formlno.bottom = new FormAttachment(0, 988);
		Label lab7 = new Label(rightComposite, SWT.NONE);
		lab7.setText("序列号");
		lab7.setLayoutData(formlno);
		final FormData formtno = new FormData();
		formtno.right = new FormAttachment(0, 260);
		formtno.left = new FormAttachment(0, 90);
		formtno.top = new FormAttachment(0, 70);
		formtno.bottom = new FormAttachment(0, 98);
		textSerNo = new Text(rightComposite, SWT.BORDER | SWT.READ_ONLY);
		textSerNo.setBackground(ColorManager.lightGray);
		textSerNo.setLayoutData(formtno);

		Composite compositenetWork = new Composite(composite, SWT.NONE);
		compositenetWork.setLayout(new GridLayout(2, false));
		compositenetWork.setLayoutData(new GridData(550, 160));
		
		
		final Group groupSvc = new Group(compositenetWork, SWT.NONE);
		groupSvc.setText("本地配置");
		groupSvc.setLayout(new FormLayout());
		GridData gdGridData = new GridData(260, 117);
		groupSvc.setLayoutData(gdGridData);

		final FormData formlpg = new FormData();
		formlpg.right = new FormAttachment(0, 73);
		formlpg.left = new FormAttachment(0, 20);
		formlpg.top = new FormAttachment(0, 11);
		formlpg.bottom = new FormAttachment(0, 37);
		formlpg.height = 15;
		formlpg.width = 100;
		Label lab13 = new Label(groupSvc, SWT.NONE);
		lab13.setText("信令端口");
		lab13.setLayoutData(formlpg);
		final FormData formtpg = new FormData();
		formtpg.right = new FormAttachment(0, 255);
		formtpg.left = new FormAttachment(0, 75);
		formtpg.top = new FormAttachment(0, 11);
		formtpg.bottom = new FormAttachment(0, 37);
		formtpg.height = 15;
		formtpg.width = 100;
		textPgPort = new Text(groupSvc, SWT.BORDER);
		GridData grid13 = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
		grid13.heightHint = 15;
		textPgPort.setLayoutData(formtpg);

		Label labstream = new Label(groupSvc, SWT.NONE);
		labstream.setText("媒体端口");
		final FormData formlstream = new FormData();
		formlstream.right = new FormAttachment(0, 73);
		formlstream.left = new FormAttachment(0, 20);
		formlstream.top = new FormAttachment(0, 41);
		formlstream.bottom = new FormAttachment(0, 66);
		formlstream.height = 15;
		formlstream.width = 100;
		labstream.setLayoutData(formlstream);
		final FormData formtstream = new FormData();
		formtstream.right = new FormAttachment(0, 255);
		formtstream.left = new FormAttachment(0, 75);
		formtstream.top = new FormAttachment(0, 41);
		formtstream.bottom = new FormAttachment(0, 66);
		formtstream.height = 15;
		formtstream.width = 100;
		textStreamPort = new Text(groupSvc, SWT.BORDER);
		GridData grid15 = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
		grid15.heightHint = 15;
		textStreamPort.setLayoutData(formtstream);
		Label labheart = new Label(groupSvc, SWT.NONE);
		labheart.setText("心跳周期");
		final FormData formlheart = new FormData();
		formlheart.right = new FormAttachment(0, 65);
		formlheart.left = new FormAttachment(0, 15);
		formlheart.top = new FormAttachment(0, 70);
		formlheart.bottom = new FormAttachment(0, 95);
		formlheart.height = 15;
		formlheart.width = 100;
		labheart.setLayoutData(formlheart);
		final FormData formtheart = new FormData();
		formtheart.right = new FormAttachment(0, 255);
		formtheart.left = new FormAttachment(0, 75);
		formtheart.top = new FormAttachment(0, 70);
		formtheart.bottom = new FormAttachment(0, 95);
		formtheart.height = 15;
		formtheart.width = 100;
		textHeart = new Text(groupSvc, SWT.BORDER);
		GridData grid19 = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
		grid19.heightHint = 15;
		textHeart.setLayoutData(formtheart);
		Group groupInGroup = new Group(compositenetWork, SWT.NONE);
		groupInGroup.setText("接入配置");
		groupInGroup.setLayout(new FormLayout());
		groupInGroup.setLayoutData(gdGridData);
		Label labinip = new Label(groupInGroup, SWT.NONE);
		labinip.setText("接入IP");
		final FormData formlInip = new FormData();
		formlInip.right = new FormAttachment(0, 80);
		formlInip.left = new FormAttachment(0, 37);
		formlInip.top = new FormAttachment(0, 11);
		formlInip.bottom = new FormAttachment(0, 37);
		labinip.setLayoutData(formlInip);
		final FormData formtInip = new FormData();
		formtInip.right = new FormAttachment(0, 255);
		formtInip.left = new FormAttachment(0, 88);
		formtInip.top = new FormAttachment(0, 11);
		formtInip.bottom = new FormAttachment(0, 37);
		textInIp = new Text(groupInGroup, SWT.BORDER);
		textInIp.setLayoutData(formtInip);
		Label labInname = new Label(groupInGroup, SWT.NONE);
		labInname.setText("接入名称");
		final FormData formlInname = new FormData();
		formlInname.right = new FormAttachment(0, 80);
		formlInname.left = new FormAttachment(0, 28);
		formlInname.top = new FormAttachment(0, 41);
		formlInname.bottom = new FormAttachment(0, 66);
		labInname.setLayoutData(formlInname);
		final FormData formtInname = new FormData();
		formtInname.right = new FormAttachment(0, 255);
		formtInname.left = new FormAttachment(0, 88);
		formtInname.top = new FormAttachment(0, 41);
		formtInname.bottom = new FormAttachment(0, 66);
		textServerName = new Text(groupInGroup, SWT.BORDER);
		textServerName.setLayoutData(formtInname);
		Label labInport = new Label(groupInGroup, SWT.NONE);
		labInport.setText("接入端口");
		final FormData formlInport = new FormData();
		formlInport.right = new FormAttachment(0, 80);
		formlInport.left = new FormAttachment(0, 30);
		formlInport.top = new FormAttachment(0, 70);
		formlInport.bottom = new FormAttachment(0, 96);
		labInport.setLayoutData(formlInport);
		final FormData formtInport = new FormData();
		formtInport.right = new FormAttachment(0, 255);
		formtInport.left = new FormAttachment(0, 88);
		formtInport.top = new FormAttachment(0, 70);
		formtInport.bottom = new FormAttachment(0, 95);
		textINPort = new Text(groupInGroup, SWT.BORDER);
		textINPort.setLayoutData(formtInport);
	}
}
